package com.ikkong.qy.core;

import com.ikkong.biz.model.WeixinUser;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

public class WeixinInterceptor implements Interceptor {

	@Override
	public void intercept(Invocation inv) {
		Controller controller = inv.getController();
		if(controller instanceof WeixinBaseController){
			WeixinUser user = ((WeixinBaseController) controller).getUser();
			controller.setAttr("user", user);
			controller.setAttr("userType", ((WeixinBaseController) controller).getUserType());
			controller.setAttr("timeStamp", System.currentTimeMillis());
			inv.invoke();
			
		}else{
			inv.invoke();
			
		}
	}

}
